package com.chess.touch.demo;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;

public class OnTouchActivity extends Activity implements View.OnTouchListener {

	Button btn = null;
	int x = 0;
	int y = 0;
	int rawx = 0;
	int rawy = 0;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.touch);
		btn = (Button)findViewById(R.id.button);
		btn.setOnTouchListener(this);
	}

	public boolean onTouch(View view, MotionEvent event) {
		int eventaction = event.getAction();
		switch (eventaction) {
		case MotionEvent.ACTION_DOWN:
			break;
		case MotionEvent.ACTION_MOVE:
			x = (int)event.getX();
			y = (int)event.getY();
			rawx = (int)event.getRawX();
			rawy = (int)event.getRawY();
			Log.d("DEBUG", "getX=" + x + "getY=" + y + "\n" + "getRawX=" + rawx + "getRawY=" + rawy + "\n");
			break;

		case MotionEvent.ACTION_UP:

			break;
		}
		return false;
	}
}
